package com.example.demo_test.Controller;

import com.example.demo_test.Entity.Message;
import com.example.demo_test.Entity.Result;
import com.example.demo_test.Service.MessageService;
import com.example.demo_test.Service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhanghong
 * @date 2021/6/7  0007 15:45
 */
@RestController
@RequestMapping("/message")
public class MessageController {
    @Autowired
    private MessageService messageService;

    @PostMapping("/addMessage")
    public void addMessage(@RequestBody Message message){
        messageService.insertMessage( message );
    }
    @GetMapping("/getMessageList")
    public List<Message> getMessageList(@Param("UserId")String userId,
                                        @Param("friendId")String friendId){
        return messageService.getMessageList(userId,friendId);
    }
    @GetMapping("/readInfo")
    public void readInfo(@Param("UserId")String userId,
                                        @Param("friendId")String friendId){
        messageService.readInfo(userId,friendId);
    }
}
